So this can be detected when replacements are detected by the used sequence matcher

this creation behaviour can be toggled with a default argument to deltaConstruction

For this, we have: an index where the replacement occurs the length of index s on q which are being lost the length of index s on w which are being gained

example:

4
6 ( 4, 5, 6, 7, 8, 9)
3 ( 4, 5, 6)

7
3 ( 7, 8, 9)
5 ( 7, 8, 9, 10, 11)

11
2 ( 11, 12)
2 ( 11, 12)

So if the length of q and w are the same then it is clear that we can do a direct comparison

if they are of differing lengths then there are different courses of action one could take to obtain a contained delta transform

we could match each possible combination and stick with the ones that create the smallest delta size, unsure how to measure size we could match each possible combination whilst retaining the joined nature of the recursive deltas in the index dimension

i think the easiest is just to match the first block, then any remaining differences can be noted as an insertion or deletion

so each of these will recieve the data as an input the possible responses will be a TransformationType

class TransformType( IntFlag):
	UNIDIRECTIONAL_DELTA= auto()
	BIDIRECTIONAL_DELTA= auto()
	NONE= auto()
	FULL= auto()

all recursive delta lists should match the preffered and fallback specified of the container if this is passed to the creation of the contained delta list then this is enforced by calculateDeltaData so possible returns will be One of UNIDIRECTIONAL_DELTA| BIDIRECTIONAL_DELTA NONE FULL

If NONE is returned then that will be in objection to the equality comparison of the SequenceMatcher

If FULL is returned then no deltas could be constructed this could be represented as a replacement then but instead of creating a replacement for all of the unmatching, the end results can be found and then any that a delta couldnt be constructed for can be grouped together as a replacement

we are only storing the delta information the operation data of indexDelta needs to be the index of the change combined with the type and delta list this works for bi and uni directionality actually index should be at the end to construct consistency

to reimagine the examples using these decisions ( assuming bidirectionality):

4
6 ( 4, 5, 6, 7, 8, 9)
3 ( 4, 5, 6)

deltas found for 6,
so:
	replace( [ a, s], [ d, f], 4)
	indexDelta( deltas from q[ 6] to w[ 6], 6)
	delete( [ a, s, d], 7)


7
3 ( 7, 8, 9)
	0, 1, 2
5 ( 7, 8, 9, 10, 11)
	0, 1, 2, 3,  4

deltas found for 7, 8,
so:
	indexDelta( deltas from q[ 7] to w[ 7], 7)
	indexDelta( deltas from q[ 8] to w[ 8], 8)
	replace( [ a], [ d], 9)
	insert( [ a, s], 10)


11
2 ( 11, 12)
2 ( 11, 12)

deltas found for none,
so:
	replace( [ a], [ d], 9)

so we give the SequenceMatcher the two sequences as they are, state ( g) The op codes that it returns have indexes into the two sequences ( g) passed into the deltaConstruction function We want the delta transforms to be reffering to a transform of the data at the state ( A) it will be in just before applying that transform That means that the sequences will have been modified by the already constructed delta transforms in the sequence matcher delta transformation set So in order to continuously transform the two sequences into ( A) we shift the index which is stored in q0Shifted This index begins at the same location for both q and w in ( a) although in ( A), q and w are not the same

i ( g) [ 3, 44, 565, 4, 5, "tree", 32] | | [ 78, 54, 4, 3, 44, 77, 6, "tree"] | |

op q0 q1 w0 w1 q0Shifted

insert 0 0 0 3 0 forwards ( a): [ 78, 54, 4, 3, 44, 565, 4, 5, "tree", 32] equal 0 2 3 5 - replace 2 5 5 7 5 forwards ( a): [ 78, 54, 4, 3, 44, 77, 6, "tree", 32] equal 5 6 7 8 - delete 6 7 8 8 8 forwards ( a): [ 78, 54, 4, 3, 44, 77, 6, "tree"]

the replace operation could be recusively calculated the replace section is marked using | at site i 565 is compared with 77 for deltas 4 is compared with 6 for deltas 5 is deleted

in order to construct the delete: we need the state a start, the q state g range state a start: q0Shifted+ wParticipatingLen, state g q start: q0+ wParticipatingLen, state g q end: q0+ qParticipatingLen,

and for insertions: an altered example [ 3, 44, 565, 4, "tree", 32] | | [ 78, 54, 4, 3, 44, 77, 6, 5, "tree"] | |

state a start: q0Shifted+ qParticipatingLen, state g q start: w0+ qParticipatingLen, state g q end: w0+ wParticipatingLen,